<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/



//加入购物车
Route::get('/cart/insert','home\GouwucheController@insert');
Route::get('/cart/index','home\GouwucheController@index');
Route::get('/cart/delete/{id}','home\GouwucheController@delete');


//前台登录
Route::get('/userLogin','home\userLoginController@login');
Route::post('/userLogin','home\userLoginController@doLogin');

//注册页面
Route::get('/uerRegister','home\RegisterController@register');
Route::post('/uerRegister','home\RegisterController@doRegister');

//搜索
Route::get('/search','home\searchController@index');

//前台ajax邮箱验证
Route::get('/ajax/dopost ','home\RegisterController@ajax');

//前台首页
Route::get('/','home\IndexController@index');

//商品分类
Route::post('/','home\IndexController@cate');

//前台列表页
Route::get('/list/{id}','home\ListController@index');
Route::get('/list/{id}/PriceA','home\ListController@priceA');
Route::get('/list/{id}/PriceD','home\ListController@priceD');

//公告
Route::get('/notice','home\noticeController@index');

//公告内容
Route::get('/content/{id}','home\contentController@index');

//详情页
Route::get('/details/{id}','home\DetailsController@index');

//查看咨询ajax
Route::get('/consultAjax','home\DetailsController@consultAjax');

//前台组
Route::group(['middleware' => 'CheckUser'],function(){

		
	//前台退出登录
	Route::get('/exitLogin','home\userLoginController@exitLogin');

	//用户评论
	Route::get('/comment/{id}','home\CommentsController@comment');
	Route::post('/doComment','home\CommentsController@doComment');

	// 地址
	Route::resource('/address','home\addressController');
	Route::get('/doget','home\addressController@doget');
	Route::post('/dopost','home\addressController@dopost');
	Route::resource('/addressEdit','home\addressEditController');

	// 个人中心
	Route::get('/info','home\infoController@index');
	Route::put('/info/{id}','home\infoController@update');

	// 修改密码
    Route::get('/pass','home\passController@index');
    Route::put('/pass/{id}','home\passController@update');

	//提交咨询
	Route::post('/addConsult','home\DetailsController@addConsult');


    //立即下单 去结算
    Route::post('/order','home\OrderController@index');
    //提交订单
    Route::post('/tijiao','home\TijiaoController@index');
    //支付
    Route::post('/zhifu','home\ZhifuController@index');
    //我的订单页
    Route::get('/wodedingdan','home\WodedingdanController@index');
    

	});

//后台首页
Route::get('/admin','admin\LoginController@index');

//验证登录
Route::post('admin/login','admin\LoginController@doLogin');

// 验证码
Route::get('/captch/{tmp}','admin\LoginController@captch');

//后台组
Route::group(['prefix'=>'admin','middleware'=>'CheckAdmin'], function () {

    //主页
    Route::get('/index',function(){
        return  view('admin.index');
    });
    Route::get('/base/nav',function(){
        return view('admin.base.nav');
    });

    // 用户管理
    Route::resource('/userManager','admin\userController'); 

    //地址管理
    Route::resource('/Address','admin\AddressController');

    //轮播管理
    Route::resource('/Carousel','admin\CarouselController');

    //公告管理
    Route::resource('/Notice','admin\NoticeController');

    // addressAdd's Ajax
    Route::get('/addressAdd','admin\addressAddController@index');
    Route::get('/addressAdd/doget','admin\addressAddController@doget');
    Route::post('/addressAdd/dopost','admin\addressAddController@dopost');

    // addressEdit's Ajax
    Route::get('/addressEdit','admin\addressEditController@index');
    Route::get('/addressEdit/doget','admin\addressEditController@doget');
    Route::post('/addressEdit/dopost','admin\addressEditController@dopost');

	//管理员resource
	Route::resource('/adminUserName','admin\adminUserNameController');

	//评论管理
	Route::resource('/comment','admin\CommentController');
	
	//获取回复信息
	Route::get('/replay','admin\ReplayController@index');
	//提交回复信息
	Route::post('/replay','admin\ReplayController@replay');
	Route::delete('/delReplay/{id}','admin\ReplayController@delReplay');

	//商品咨询
	Route::get('/consult','admin\ConsultController@index');
	Route::get('/consult/{id}','admin\ConsultController@delConsult');

	//咨询admin 回复首页
	Route::get('/consultRe/{id}','admin\ConsultController@consultRe');
	//咨询回复
	Route::post('/consultRe','admin\ConsultController@doConsultRe');
	//删除回复
	Route::get('/delConsultRe/{id}','admin\ConsultController@delConsultRe');



    //商品咨询
    Route::get('/consult','admin\ConsultController@index');
    Route::get('/consult/{id}','admin\ConsultController@delConsult');

    //咨询admin 回复首页
    Route::get('/consultRe/{id}','admin\ConsultController@consultRe');
    //咨询回复
    Route::post('/consultRe','admin\ConsultController@doConsultRe');
    //删除回复
    Route::get('/delConsultRe/{id}','admin\ConsultController@delConsultRe');

    //退出登录
    Route::get('/Logout','admin\LoginController@Logout');

    //网站基本信息管理 
    Route::resource('/storeConfig','admin\ConfigController');

    //友情链接
    Route::resource('/storeLinks','admin\LinksController');

    /*后台*/
	/*商品分类管理*/
	Route::resource('/goodscate','admin\Goods\GoodsCateController');
    /*商品详情管理*/
	Route::resource('/goodsmain','admin\Goods\GoodsMainController');
   /*商品管理*/
	Route::resource('/goods','admin\Goods\GoodssController');


});





